import {Agent} from './Agent';

abstract class Customer{
  agent:Agent;
  name:string;
  constructor(name:string, agent:Agent){
    this.name = name;
    this.agent = agent;
  }
}

class HouseOwner extends Customer{
  contact(message:string):void{
    this.agent.contact(message, this);
  }

  getMessage(message:string):void{
    console.log(`房东[${this.name}]获得信息：${message}`);
  }
}

class Tenant extends Customer{
  contact(message:string):void{
    this.agent.contact(message, this);
  }
  getMessage(message:string):void{
    console.log(`房客[${this.name}]获得信息：${message}`);
  }
}

export {Customer, HouseOwner, Tenant};